package com.way.designpatterncodepratice.proxy.other;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * @author wayleung
 * @description
 * @date 2020-08-12 10:38:32
 */
public class MyMethodInterceptor implements MethodInterceptor {


    @Override
    public Object intercept(Object target, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
        System.out.println("代理前做点东西");
        Object result = methodProxy.invokeSuper(target, args);
        System.out.println("代理后做点东西");
        return result;
    }
}
